home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 007a / cug315.zip / README.TXT < prev    next >
Text File  |  1990-05-16  |  16KB  |  238 lines

  1.  
  2. FTGRAPH.EXE was created to go with my article in _Intelligent Instruments and
  3. Computers_. ("Understanding and Using Fast Fourier Transforms", Thomas Clune,
  4. _II&C_ v.7 n.3, May/June, 1989, p.103 ff). That article explains the concepts
  5. that are behind the FTGRAPH.EXE package, and should be considered part of
  6. the documentation for FTGRAPH's use. This file is intended as an aid to
  7. installation and configuration of FTGRAPH, not as a "user manual" for people
  8. unfamiliar with the FT and its uses.
  9.  
  10. FTGRAPH.EXE is a set of utilities for performing Fourier transforms and
  11. inverse Fourier transforms.  The minimum requirements for program operation
  12. are: an IBM PC, XT, AT, or clone, 256 K or more RAM, MS-DOS or PC-DOS, v.2.0
  13. or later.  The program will use a numerical coprocessor (8087, 80287, or
  14. 80387) if it is present, but does not require it.  The program supports any of
  15. the standard graphics screen adaptors (Hercules, CGA, EGA, and VGA graphics are
  16. supported). Note Well: if you are using a Hercules Graphics adaptor, you must 
  17. install MSHERC.COM for graphics support.  MSHERC is a Microsoft program, but 
  18. is distributed here with Microsoft's permission.  Or, you can output HPGL files 
  19. (HPGL, Hewlett-Packard Graphics Language, is the language used by HP-compatible
  20. plotters.)  Various devices support HPGL.  For example, at the Institute we 
  21. often send HPGL files to a Hewlett-Packard LaserJet, using a utility marketed 
  22. by HP (LaserPlotter, from Insight Development Corp.).  This is an easy way to 
  23. get high-quality graphics out of different devices.  NOTE THAT FTGRAPH DOES NOT
  24. OUTPUT HPGL DATA TO A PLOTTER.  Rather, it creates a file of HPGL data that
  25. can then be copied to the graphics output device using either a utility like
  26. LaserPlotter or, if you are outputting to an HP-compatible plotter, by
  27. using the DOS COPY command.  For example, if the HP plotter is attached
  28. to COM1: and you have set the MODE command to be compatible with the plotter
  29. settings (see DOS manual), just COPY yourfile.plt COM1 at the DOS prompt.
  30.  
  31. In order for FTGRAPH to work properly, you must be operating under ANSI.SYS.
  32. This is a terminal control program that comes with DOS.  To install ANSI.SYS,
  33. you must have a line DEVICE=ANSI.SYS in your CONFIG.SYS file, and the ANSI.SYS
  34. program must be in the root directory of your boot disk.  See the DOS manual
  35. for details.
  36.  
  37. The file FTGRAPH.CNF is a configuration file that must be located in the same
  38. directory as FTGRAPH.EXE.  There are six arguments in the file.  They are:
  39. 1. The first number is a floating-point value that specifies the smallest
  40. amplitude that the program will consider as significant when you use polar
  41. coordinates (amplitude/phase) for your transform.  This value
  42. is used to decide whether the phase argument is significant, or just noise.
  43. An FFT will calculate phase even if there is no signal at the given frequency,
  44. so this value is used to decide whether phase should be set to 0 because there
  45. really isn't any signal there.  It does not apply to rectangular format data
  46. transforms (real/imaginary).
  47. 2. The second number is an integer used as a flag to tell the program whether
  48. you want to use the entire transform (both positive and negative frequencies)
  49. or just the positive frequencies.  Often, if you are using real data, you
  50. will limit your frequency display to positive values.  However, there are
  51. times that positive/negative are desirable.  For example, if you are going to 
  52. process data in the frequency domain and re-transform it back to the time 
  53. domain, you must use both positive and negative frequencies or you will lose
  54. half the data points during transformation. NOTE WELL: to lessen this problem, 
  55. I transform data files for filtering as positive/negative, even if you select 
  56. positive-only display. Thus, the re-transformed time domain data will contain 
  57. the full number of values. 
  58. 3. The third value is an integer flag that specifies whether you want to use
  59. rectangular coordinates (real/imaginary) or polar (amplitude/phase) coordinates
  60. for your frequency domain data.
  61. 4. The fourth value is the units for filter rolloff.  2.0= dB/octave, 10.0=
  62. dB/decade.
  63. 5. The fifth argument is the number of decimals (INTEGER ARGUMENT) that you
  64. want to use in your floating-point printer dumps of data files (either [seconds,
  65. magnitude] or [frequency, magnitude] files).  This number is for printer
  66. display ONLY, and does not affect the precision of calculation in the program.
  67. 6. The last value is an integer flag that specifies whether you want to be
  68. able to select from the menu using only keyboard inputs or both mouse
  69. (Microsoft compatible only) and keyboard.  NOTE WELL: if you use the mouse,
  70. the RIGHT-HAND button is used to enter your selection.  Moving the mouse
  71. will move the highlight to the choice you want to make.  WARNING: If you set
  72. this variable to 1 (enable mouse operation) and a valid mouse is not installed
  73. on your computer, the program will hang, and may display a FLOATING POINT 
  74. COPROCESSOR UNDERFLOW error message.  Always disable the mouse option in the
  75. configuration file if you do not have a Microsoft(-like) mouse on your system.
  76. Remember that you must have a line like DEVICE=MOUSE.SYS in your CONFIG.SYS
  77. file in order to install the mouse device driver.
  78.  
  79. All these arguments are explained in the FTGRAPH.CNF file itself.  You may
  80. edit the file with a common word processor to customize the package to your
  81. taste.  WARNING: Do not capriciously move from positive to positive/negative,
  82. or polar to rectangular coords.  The program does not keep a record of which
  83. format was used with which data file.  The current settings ARE ASSUMED TO
  84. BE THE CORRECT ONES for the data file under analysis.  If a file was collected
  85. using positive only settings, and transformed under the positive/negative
  86. format, for example, it will assume that the file contains both positive and
  87. negative data.  Similarly, there is nothing in the file that identifies the
  88. data as time-domain or frequency domain, etc.  Establish a format that
  89. is right for your applications, and stick with it.  Since the right format
  90. for display is often different from the right format for data processing, as
  91. explained above, FTGRAPH allows you to change the default settings within
  92. the program by selecting menu item B.  NOTE WELL: resetting defaults using
  93. menu item B applies only as long as the program is running.  When you load
  94. FTGRAPH, it reads its initial conditions from FTGRAPH.CNF, so the only way
  95. to make changes in configuration permanent is by editing that file.
  96.  
  97. The data files that are read by this program must have the following format:
  98. The files are plain ASCII text files,and the first line of the file contains
  99. three numbers.  First is an integer specifying how many data points are in the
  100. file.  The program expects a power of 2 size data set ONLY.  If the number of
  101. points in the data set is not a power of 2, the program will automatically
  102. zero-fill the working set (not the disk data) to the next highest power of two.
  103. The second and third number are floating point numbers used to scale graphs if
  104. they will be something other than full-scale. The second number is the minimum
  105. y value of the graph scale, and the third number is the maximum y value for
  106. the graph. Note that you can set multiple graphs to the same scale by making
  107. these numbers the same in the various data sets. This lets you compare 
  108. magnitudes across graphs. Also, if you wish to expand the scale of a graph,
  109. this feature will let you clip the graph at min and max values of your choice.
  110. Alternatively, you may set both the min and max values to the same value. This
  111. serves as a flag to the program to autoscale the graph to fill the screen. As
  112. a convention, I suggest using 0 for the min and max if you want to autoscale.
  113. By the way, when FTGRAPH creates a data file the values that it uses for the
  114. minimum and maximum are the actual minimum and maximum of the data set.
  115. All numbers in the data file are separated by white space only (space, tab, or
  116. carriage return).  That is, there are no commas or semicolons allowed.  After
  117. the first three numbers comes the data set: floating point numbers separated
  118. by white space.  If you are unclear on the format, see one of the sample
  119. data sets included here (any .DAT file).  All .DAT files included here are
  120. time-domain files.
  121.  
  122. The sample data sets are: A 16-cycles square wave data set
  123. in SQUARE.DAT, a gaussian waveform (GAUSS.DAT), a sine and a cosine wave
  124. data file TWOWAVES.DAT, a noisy Gaussian curve in NOISY_GS.DAT, included
  125. for demonstrating correlation, and HANNING.DAT, for use in demonstrating
  126. windowing with the multiplication option.  Notice that the multiplication
  127. feature of the program lets you window data sets if you define your window as
  128. a data file and multiply the window with the data set.  I remind you that
  129. multiplying in one domain is the same as convolving in the other.  Thus, the
  130. combination of being able to transform, inverse transform, and to multiply
  131. allows you to perform convolutions. This is the basis for the filtering option.
  132. The time-domain data is transformed to the frequency domain, the filter is
  133. defined in the frequency domain and then multiplied by the transformed data,
  134. then the filtered data is transformed back to the time domain.  If you like,
  135. you can save the filter that you define for later use.  But remember that the
  136. data file needs the same number of data points as the filter file, and the
  137. sampling frequency in the data file must be the same as that used in defining
  138. the filter. Also, the choice of positive/negative or just positive frequencies
  139. will affect the filtering operation.  These bookkeeping points are managed for
  140. you when you select the FILTER option.
  141.  
  142. The program internally does forward and inverse transforms in rectangular
  143. format, performing polar-to-rectangular conversions as necessary before or
  144. after an FFT.  The exception to this is that power spectra are left in power
  145. spectrum format during conversion to correlation spectra. You should always use
  146. the CORRELATION menu item for doing correlations instead of selecting INVERSE
  147. TRANSFORM on a power spectrum, therefore.
  148.  
  149. Whenever one prepares a general-purpose package, there are various compromises
  150. that must be made.  These include limiting the end-user's access to various
  151. parameters so that the package can be used without the user having to know
  152. as much about the program as the programmer does, but providing the user with
  153. access to the parameters that (s)he will likely want to change, etc.  Some
  154. of the most difficult choices that I have made have to do with balancing the
  155. usual desires for how data will be displayed with the usual desires of how
  156. the data will be processed.  In particular, positive/negative frequencies
  157. have been a sticking point for me.  If you want to display only positive
  158. frequencies, that does not mean that you want to process data as positive-
  159. only, for example. I have made the filter function perform the FT of data
  160. to be filtered as pos/neg, even if you have selected positive-only for your
  161. ft displays.  Thus, when the filtered data is transformed back to the time
  162. domain, it contains the same number of data points as the unfiltered data.
  163. However, if you save a filter for viewing or inverse transforming to see
  164. the ripple, etc, the filter is saved as either pos/neg or pos only, depending
  165. on how you have selected your options.  My expectation is that these choices
  166. will make the program behave according to naive expectations in the majority
  167. of cases, but such choices are fraught with peril.  Let the user beware.
  168. Similarly, when you choose to use both positive and negative frequencies in
  169. your display, I assume that you want the transform ordered temporally.  That
  170. is, I unscramble the transform to present a continuous x-axis format to the
  171. data.  Thus, when I inverse transform data where the positive/negative
  172. frequencies have been selected, I must reorder the data under the assumption
  173. that I had previously unscrambled the data.  These kinds of assumptions and
  174. decisions have a way of proving inappropriate for a surprisingly large
  175. percentage of users.  I have therefore included all the source code that I
  176. have used to construct the routines.  If you read over the source code, you
  177. will soon see that there are many functions included in the library that
  178. are not used in FTGRAPH.  These functions are designed to provide full
  179. support for a text-based menuing system, Microsoft mouse control, full
  180. HPGL plotter support, etc.  My hope is that, if the options that I have made 
  181. accessable in FTGRAPH are not suited to you, the library of functions will be.
  182.  
  183. The programs used to create the FTGRAPH package are included in source as
  184. .C files or the supporting .H files.  The program and the library were
  185. compiled using Microsoft C v. 5.1, large memory model.  Microsoft-specific
  186. features were used, so the programs should not be considered portable.
  187. I compiled these modules with optimization disabled (/Od flag), and recommend
  188. that you do the same at least with my code. The only other flag used was '/AL'. 
  189. Large memory model should always be used.  You may modify the source as
  190. you see fit, but I will not provide support for anything but the distributed
  191. form of the program.  To link, use the following:
  192. LINK/ST:6000 FTGRAPH,,,FTPLOT MOUSELIB MOUSE GRAPHICS
  193.  
  194. The package requires the Microsoft mouse driver library, MOUSE.LIB, in order
  195. to compile (my version is dated 1-23-89  Make sure that your mouse.lib is recent
  196. enough to contain cmousel()).  In case you do not have mouse.lib, you can still
  197. compile and link the program using NONMOUSE.LIB instead of MOUSELIB.LIB.  The
  198. link command would then be:
  199. LINK/ST:6000 FTGRAPH,,,FTPLOT NONMOUSE GRAPHICS
  200.  
  201. All functions that call MOUSE.LIB are in the file MOUSELIB.C, and the source 
  202. file replacing it on non-mouse systems is NONMOUSE.C.  All that NONMOUSE.C
  203. does is stub the mouse calls to avoid unresolved externals at link time.
  204. If you try to call a mouse function after linking NONMOUSE.LIB, the program
  205. will display an error message.
  206.  
  207. Alternatively, if you have a mouse and MOUSE.SYS, you can use my MOUS_SYS.LIB 
  208. instead of MOUSE.LIB.  The way to compile and link with this library is:
  209. LINK/ST:6000 FTGRAPH,,,FTPLOT MOUSELIB MOUS_SYS GRAPHICS
  210.  
  211. This program finds the .CNF file it needs by reading the filespec in ARGV[0].
  212. This argument normally contains the full filespec for the program, e.g.,
  213. C:\FT_DIR\SUB_DIR\FTGRAPH.EXE.  The program then replaces the "EXE" with
  214. "CNF."  The reason to do this is that the DOS PATH argument will find
  215. executable files (.BAT, .COM, or .EXE) ONLY.  Thus, this program expects
  216. the .CNF file to be in the same directory as the .EXE file, and by using
  217. the ARGV[0] mechanism, it can operate under any configuration that the
  218. program can operate under.  At least that is the theory.  Unfortunately,
  219. versions of DOS before 3.0 and some unusual DOS clones do not support
  220. passing the filespec of the program in ARGV[0].  Thus, I have provided a
  221. second way of finding the .CNF file.  If the ARGV[0] approach fails, I will
  222. check the default directory for the .CNF file.  If you get an "Unable to
  223. find configuration file" error message, even though the .CNF file is in
  224. the same directory as the .EXE file, you must copy the .CNF file to the
  225. default directory you will be using when you run the program.  If you are
  226. going to compile your own version of these routines, make sure that you read
  227. the comments in FTGRAPH.C and FTGRAPH.H about how to handle this situation.
  228.  
  229. I  hope you enjoy the package.  I remind you that the program is copyright
  230. (Copyright (c) 1989, Eye Research Institute, 20 Staniford St., Boston, MA
  231. 02114.  All rights reserved.)  You are free to use the program for non-
  232. commercial purposes.  However, if you are trying to make a profit on it, we
  233. at E.R.I. want to talk to you about getting our share.
  234.  
  235. If you need support getting the program set up, feel free to contact me at:
  236. Tom Clune, (617) 723-6078, x545, or write me c/o E.R.I. at the address above.
  237.     --tom clune
  238.